<?php

class backmoneyModel extends Model {

    private $table = '`sd_backmoney`';

    public function add($data) {        
        return $this->_insert($this->table, $data);
    }
    
    public function all($id) {        
        return $this->_all("SELECT * FROM `sd_backmoney` where  member_id = {$id} order by backmoney_id desc");
    }
    
    public function all2() {        
        return $this->_all("SELECT sd_backmoney.*,sd_member.name FROM `sd_backmoney`,`sd_member` WHERE sd_backmoney.member_id = sd_member.member_id order by backmoney_id desc");
    }
    
    public function update($data,$id){
        $where = "WHERE backmoney_id = " . $id;
        Return $this->_update($this->table, $data, $where);
    }
}
